<!DOCTYPE html>
<html>
<head>
<include file="Include:meta" />
<title>日程管理-目的地运营集团数据管理平台</title>
<include file="Include:style" />
<link rel="stylesheet" href="__PUBLIC__/mobile/css/mobiscroll.min.css">
</head>
<body style="background: #f3f3f3;">
<div class="header">
	<a href="__APP__/Mobile/Index/index" class="back_btn"></a>
	日程管理
	<a href="javascript:;" class="add_btn"></a>
</div>
<include file="Include:commu_menu" />
<div class="content">
	<div id="calendar" class="mb10"></div>
	<div class="schedule_list">
		<ul>
			<foreach name="data" item="vo">
				<if condition="$vo['type'] eq 1">
					<li class="lis_zg">
						<div class="tit"><i>{$vo['work_name']}</i><span class="float_r">{$vo['show_date']}</span></div>
						<p>{$vo['work_content']}</p>
						<input type="hidden" gw="{$vo['fill_post_name']}" xm="{$vo['project_num']}" sx="{$vo['matter_id']}" mid="{$vo['id']}" noedit="{$vo['noedit']}">
					</li>
				<elseif condition="$vo['type'] eq 2"/>
					<li class="lis_cc">
						<div class="tit"><i>{$vo['work_name']}</i><span class="float_r">{$vo['show_date']}</span></div>
						<p>{$vo['work_content']}</p>
						<input type="hidden" gw="{$vo['fill_post_name']}" xm="{$vo['project_num']}" sx="{$vo['matter_id']}" mid="{$vo['id']}" noedit="{$vo['noedit']}">
					</li>
				<elseif condition="$vo['type'] eq 3"/>
					<li class="lis_xx">
						<div class="tit">{$vo['type_name']}<span class="float_r">{$vo['show_date']}</span></div>
						<p>代理人:<if condition="$vo['agent_post'] eq NULL">{$vo['agent_name']}-{$vo['position']}<else/>{$vo['agent']}-{$vo['agent_post']}</if></p>
						<if condition="$vo['agent_post'] eq NULL">
							<input type='hidden' gw="{$vo['fill_post_name']}" xm="{$vo['project_num']}"	name="{$vo['agent_name']}" zw="{$vo['position']}" sj="{$vo['mobilephone']}" mid="{$vo['id']}" noedit="{$vo['noedit']}" cur="{$vo['status']}" dh_message="{$vo['dh_message']}" arrive_status="{$vo['arrive_status']}">
						<else/>
							<input type='hidden' gw="{$vo['fill_post_name']}" xm="{$vo['project_num']}" name="{$vo['agent']}" zw="{$vo['agent_post']}" sj="{$vo['agent_tel']}" mid="{$vo['id']}" noedit="{$vo['noedit']}" cur="{$vo['status']}" dh_message="{$vo['dh_message']}" arrive_status="{$vo['arrive_status']}">
						</if>
					</li>
				<elseif condition="$vo['type'] eq 4"/>
					<li class="lis_qj">
						<div class="tit">{$vo['type_name']}<span class="float_r">{$vo['show_date']}</span></div>
						<p>EKP单号:{$vo['ekp']}</p>
						<input type="hidden" gw="{$vo['fill_post_name']}" xm="{$vo['project_num']}" ekp="{$vo['ekp']}" mid="{$vo['id']}" noedit="{$vo['noedit']}">
					</li>
				</if>
			</foreach>
		</ul>
	</div>
</div>
<!-- 弹出框 -->
<div class="calendar_fix">
	<input type="hidden" id="fix_date">
	<div class="btn">
		<a class="btn_zg" href="javascript:;" type="1"><span>在岗</span></a><a class="btn_cc" href="javascript:;" type="2"><span>出差</span></a><a class="btn_xx" href="javascript:;" type="3"><span>休息</span></a><a class="btn_qj" href="javascript:;" type="4"><span>请假</span></a>
		<input name="hide" type="hidden" end="">
	</div>
</div>
<!-- 详细 -->
<div class="customer_alert slide_alert zg">
	<div class="alert_title">
		<a class="delete det" href="javascript:;">删除</a>
		<div class="txt zg"><img src="__PUBLIC__/mobile/images/index/lisdet_icon1.png"><p>在 岗</p></div>
		<a class="close" href="javascript:;"><img src="__PUBLIC__/mobile/images/project/clo_icon_y2.png"></a>
	</div>
	<div class="alert_body">
		<div class="form_table">
			<table class="mb15">
				<tr>
					<td class="form_table_left">起止日期</td>
					<td class="form_table_right"></td>
				</tr>
				<tr>
					<td class="form_table_left">填报岗位</td>
					<td class="form_table_right"></td>
				</tr>
				<tr>
					<td class="form_table_left">项目编号</td>
					<td class="form_table_right"></td>
				</tr>
				<tr>
					<td class="form_table_left">事项编号</td>
					<td class="form_table_right"></td>
				</tr>
				<tr>
					<td class="form_table_left">工作类型</td>
					<td class="form_table_right"></td>
				</tr>
				<tr>
					<td class="form_table_left">工作内容</td>
					<td class="form_table_right"></td>
				</tr>
			</table>
			<button type="button" class="sub_btn zg">编 辑</button>
		</div>
	</div>
</div>
<div class="customer_alert slide_alert cc">
	<div class="alert_title">
		<a class="delete det" href="javascript:;">删除</a>
		<div class="txt cc"><img src="__PUBLIC__/mobile/images/index/lisdet_icon2.png"><p>出 差</p></div>
		<a class="close" href="javascript:;"><img src="__PUBLIC__/mobile/images/project/clo_icon_y2.png"></a>
	</div>
	<div class="alert_body">
		<div class="form_table">
			<table class="mb15">
				<tr>
					<td class="form_table_left">起止日期</td>
					<td class="form_table_right"></td>
				</tr>
				<tr>
					<td class="form_table_left">填报岗位</td>
					<td class="form_table_right"></td>
				</tr>
				<tr>
					<td class="form_table_left">项目编号</td>
					<td class="form_table_right"></td>
				</tr>
				<tr>
					<td class="form_table_left">事项编号</td>
					<td class="form_table_right"></td>
				</tr>
				<tr>
					<td class="form_table_left">工作类型</td>
					<td class="form_table_right"></td>
				</tr>
				<tr>
					<td class="form_table_left">工作内容</td>
					<td class="form_table_right"></td>
				</tr>
			</table>
			<button type="button" class="sub_btn cc">编 辑</button>
		</div>
	</div>
</div>
<div class="customer_alert slide_alert xx">
	<div class="alert_title">
		<a class="delete det" href="javascript:;">删除</a><a class="delete down" href="javascript:;" id="">放弃提交</a><a class="delete sub" href="javascript:;" uuid="{$login_id}" id="">提交审核</a>
		<div class="txt xx"><img src="__PUBLIC__/mobile/images/index/lisdet_icon3.png"><p>休 息</p></div>
		<a class="close" href="javascript:;"><img src="__PUBLIC__/mobile/images/project/clo_icon_y2.png"></a>
	</div>
	<div class="alert_body">
		<div class="form_table">
			<table class="mb15">
				<tr>
					<td class="form_table_left">起止日期</td>
					<td class="form_table_right"></td>
				</tr>
				<tr>
					<td class="form_table_left">填报岗位</td>
					<td class="form_table_right"></td>
				</tr>
				<tr>
					<td class="form_table_left">项目编号</td>
					<td class="form_table_right"></td>
				</tr>
				<tr>
					<td class="form_table_left">代理人</td>
					<td class="form_table_right"></td>
				</tr>
				<tr>
					<td class="form_table_left">代理人职务</td>
					<td class="form_table_right"></td>
				</tr>
				<tr>
					<td class="form_table_left">手机号</td>
					<td class="form_table_right"></td>
				</tr>
			</table>
			<button type="button" class="sub_btn xx">编 辑</button>
		</div>
	</div>
</div>
<div class="customer_alert slide_alert qj">
	<div class="alert_title">
		<a class="delete det" href="javascript:;">删除</a>
		<div class="txt qj"><img src="__PUBLIC__/mobile/images/index/lisdet_icon4.png"><p>请 假</p></div>
		<a class="close" href="javascript:;"><img src="__PUBLIC__/mobile/images/project/clo_icon_y2.png"></a>
	</div>
	<div class="alert_body">
		<div class="form_table">
			<table class="mb15">
				<tr>
					<td class="form_table_left">起止日期</td>
					<td class="form_table_right"></td>
				</tr>
				<tr>
					<td class="form_table_left">填报岗位</td>
					<td class="form_table_right"></td>
				</tr>
				<tr>
					<td class="form_table_left">项目编号</td>
					<td class="form_table_right"></td>
				</tr>
				<tr>
					<td class="form_table_left">EKP单号</td>
					<td class="form_table_right"></td>
				</tr>
			</table>
			<div style="height:74px"></div>
			<button type="button" class="sub_btn qj">编 辑</button>
		</div>
	</div>
</div>
<include file="Include:javascript" />
<script src="__PUBLIC__/mobile/js/mobiscroll.min.js"></script>
<script>
    $(function(){
		$(".back_btn").click(function(){sessionStorage.clear();});
		$('.customer_alert .close').click(function(){
			$(this).parents('.customer_alert').removeClass('active');
			$('.Mask').fadeOut(function(){
				$(this).remove();
			})
		})
		//详细页
		$('body').on('click','.lis_zg',function(){
			$('.customer_alert.zg').addClass('active');
			Mask();
			var date = $(this).find('span').text(),
				gw = $(this).find('input').attr('gw'),
				xm = $(this).find('input').attr('xm'),
				sx = $(this).find('input').attr('sx'),
				id = $(this).find('input').attr('mid'),
				lx = $(this).find('i').text(),
				nr = $(this).find('p').text(),
				noedit = $(this).find('input').attr('noedit');
			if(noedit==1){
				$('.customer_alert.zg button').hide();
				$('.customer_alert.zg .delete').hide();
			}else{
				$('.customer_alert.zg button').attr("id",id).show();
				$('.customer_alert.zg .delete').show();
			}
			$('.customer_alert.zg').find('tr').eq(0).find('.form_table_right').html(date);
			$('.customer_alert.zg').find('tr').eq(1).find('.form_table_right').html(gw);
			$('.customer_alert.zg').find('tr').eq(2).find('.form_table_right').html(xm);
			$('.customer_alert.zg').find('tr').eq(3).find('.form_table_right').html(sx);
			$('.customer_alert.zg').find('tr').eq(4).find('.form_table_right').html(lx);
			$('.customer_alert.zg').find('tr').eq(5).find('.form_table_right').html(nr);
			$('.customer_alert.zg').find('.delete').attr("mid",id);
		})
		$('body').on('click','.lis_cc',function(){
			$('.customer_alert.cc').addClass('active');
			Mask();
			var date = $(this).find('span').text(),
				gw = $(this).find('input').attr('gw'),
				xm = $(this).find('input').attr('xm'),
				sx = $(this).find('input').attr('sx'),
				id = $(this).find('input').attr('mid'),
				lx = $(this).find('i').text(),
				nr = $(this).find('p').text(),
				noedit = $(this).find('input').attr('noedit');
			if(noedit==1){
				$('.customer_alert.cc button').hide();
				$('.customer_alert.cc .delete').hide();
			}else{
				$('.customer_alert.cc button').attr("id",id).show();
				$('.customer_alert.cc .delete').show();
			}
			$('.customer_alert.cc').find('tr').eq(0).find('.form_table_right').html(date);
			$('.customer_alert.cc').find('tr').eq(1).find('.form_table_right').html(gw);
			$('.customer_alert.cc').find('tr').eq(2).find('.form_table_right').html(xm);
			$('.customer_alert.cc').find('tr').eq(3).find('.form_table_right').html(sx);
			$('.customer_alert.cc').find('tr').eq(4).find('.form_table_right').html(lx);
			$('.customer_alert.cc').find('tr').eq(5).find('.form_table_right').html(nr);
			$('.customer_alert.cc').find('.delete').attr("mid",id);
		})
		$('body').on('click','.lis_xx',function(){
			$('.customer_alert.xx').addClass('active');
			Mask();
			var date = $(this).find('span').text(),
				gw = $(this).find('input').attr('gw'),
				xm = $(this).find('input').attr('xm'),
				name = $(this).find('input').attr('name'),
				zw = $(this).find('input').attr('zw'),
				sj = $(this).find('input').attr('sj'),
				id = $(this).find('input').attr('mid'),
				cur = $(this).find('input').attr('cur'),
				noedit = $(this).find('input').attr('noedit');
			if(noedit==1){
				$('.customer_alert.xx button').hide();
				$('.customer_alert.xx .delete').hide();
			}else{
				if(cur==-1){
					$('.customer_alert.xx .sub').show();
					$('.customer_alert.xx .det').show();
					$('.customer_alert.xx .down').hide();
					$('.customer_alert.xx button').attr("id",id).show();
				}else if(cur==1){
					$('.customer_alert.xx .down').show();
					$('.customer_alert.xx .sub').hide();
					$('.customer_alert.xx .det').hide();
					$('.customer_alert.xx button').hide();
				}else{
					$('.customer_alert.xx button').hide();
					$('.customer_alert.xx .delete').hide();
				}
			}
			$('.customer_alert.xx').find('tr').eq(0).find('.form_table_right').html(date);
			$('.customer_alert.xx').find('tr').eq(1).find('.form_table_right').html(gw);
			$('.customer_alert.xx').find('tr').eq(2).find('.form_table_right').html(xm);
			$('.customer_alert.xx').find('tr').eq(3).find('.form_table_right').html(name);
			$('.customer_alert.xx').find('tr').eq(4).find('.form_table_right').html(zw);
			$('.customer_alert.xx').find('tr').eq(5).find('.form_table_right').html(sj);
			$('.customer_alert.xx').find('.delete').attr("mid",id);
		})
		$('body').on('click','.lis_qj',function(){
			$('.customer_alert.qj').addClass('active');
			Mask();
			var date = $(this).find('span').text(),
				gw = $(this).find('input').attr('gw'),
				xm = $(this).find('input').attr('xm'),
				ekp = $(this).find('input').attr('ekp'),
				id = $(this).find('input').attr('mid'),
				noedit = $(this).find('input').attr('noedit');
			if(noedit==1){
				$('.customer_alert.qj button').hide();
				$('.customer_alert.qj .delete').hide();
			}else{
				$('.customer_alert.qj button').attr("id",id).show();
				$('.customer_alert.qj .delete').show();
			}
			$('.customer_alert.qj').find('tr').eq(0).find('.form_table_right').html(date);
			$('.customer_alert.qj').find('tr').eq(1).find('.form_table_right').html(gw);
			$('.customer_alert.qj').find('tr').eq(2).find('.form_table_right').html(xm);
			$('.customer_alert.qj').find('tr').eq(3).find('.form_table_right').html(ekp);
			$('.customer_alert.qj').find('.delete').attr("mid",id);
		})
		$('.customer_alert .delete.det').ajaxModal({"body_text":"您确定要删除吗？","url":"__APP__/Mobile/Index/schedule_list_action","data":{"id":"mid"}});
		//xx提交
		$('.customer_alert.xx .sub').click(function(){
			var status = 1,
				uuid = $(this).attr("uuid"),
				state = 1,
				mid = $(this).attr("mid");
			$.ajax({
				cache:true,
				type:"POST",
				dataType:"json",
				data:{"mid":mid,"status":status,"uuid":uuid,"state":state},
				url:"__APP__/Mobile/Index/schedule_list_audit_ajax",
				success:function(data){
					$('#edit_modal').hide();
					success_pop(data.status,data.msg);
				}
			});
		})
		//xx放弃提交
		$('.customer_alert.xx .down').click(function(){
			var status = -1,
				state = 1,
				mid = $(this).attr("mid");
			$.ajax({
				cache:true,
				type:"POST",
				dataType:"json",
				data:{"mid":mid,"status":status,"state":state},
				url:"__APP__/Mobile/Index/schedule_list_audit_ajax",
				success:function(data){
					$('#edit_modal').hide();
					success_pop(data.status,data.msg);
				}
			});
		})
		//编辑
		$('.customer_alert .sub_btn').click(function(){
			var id = $(this).attr('id');
			location.href="__APP__/Mobile/Index/schedule_list_add/id/"+id+"";
		})
		//添加
		$(".add_btn").click(function(){
			$(".calendar_fix").fadeIn();
			Mask();
			$('#fix_date').mobiscroll().range({
				theme: 'ios',
				lang: 'zh',
				display: 'inline',
				min: min,
				max: max,
				defaultValue: now,
				onSetDate: function (event, inst) {
					var dates = event.active;
					if(dates=="start"){
						var start = formatDate(event.date);
						$("[name='hide']").attr('start',start)
					}else{
						var end = formatDate(event.date);
						$("[name='hide']").attr('end',end)
					}
    			}
			});
		})
		$(".btn a").click(function(){
			$(this).addClass('active').siblings().removeClass('active');
			var type = $(this).attr('type'),
				start = $("[name='hide']").attr('start'),
				end = $("[name='hide']").attr('end');
			$.ajax({
				type:"POST",
				async:false,
				dataType:"json",
				data:{"type":type,"start":start,"end":end,"action":"next"},
				url:"__APP__/Mobile/Index/schedule_list_ajax",
				success : function (data) {
					if(data.status==0){
						$('.calendar_fix').hide();
						$('.Mask').remove();
						success_pop(data['status'],data['msg']);
					}else{
						location.href="__APP__/Mobile/Index/schedule_list_add/type/"+type+"/start/"+start+"/end/"+end+"";
					}
				}
			})

		})
		var now = new Date(),
			min = new Date(now.getFullYear(), now.getMonth(), now.getDate()-7);
        	max = new Date(now.getFullYear(), now.getMonth(), now.getDate()+7);
		
		$('#calendar').mobiscroll().calendar({
			display: 'inline',
			layout: 'liquid',
			theme: 'ios',
			lang: 'zh',
			dateFormat: 'yy/mm/dd',
			markedDisplay: 'bottom',
			yearChange: false,
			startYear: (new Date()).getFullYear()-2,
			endYear: (new Date()).getFullYear()+1,
			onMonthLoading: function (event, inst) {
				var year = event.year,
                	month = event.month;
				$.ajax({
					type:"POST",
					async:false,
					dataType:"json",
					data:{"year":year,"month":month,"action":"detail"},
					url:"__APP__/Mobile/Index/schedule_list_ajax",
					success : function (data) {
						inst.settings.marked = [];
						if(data['date']){
							for (var i = 0; i < data['date'].length; i++) {
								if(data['date'][i].date){
									inst.settings.marked.push({
										d: new Date(''+data['date'][i].date+''), 
										color: ''+data['date'][i].color+''
									});
								}else{
									inst.settings.marked.push({
										start: new Date(''+data['date'][i].start_date+''),
										end: new Date(''+data['date'][i].end_date+''),
										color: ''+data['date'][i].color+''
									});
								}
							}
						}
						inst.redraw();
					}
				});
			},
			onDayChange: function (event, inst) {
				var dates = formatDate(event.date);
				$.ajax({
					type:"POST",
					async:false,
					dataType:"json",
					data:{"dates":dates,"action":"list"},
					url:"__APP__/Mobile/Index/schedule_list_ajax",
					success : function (data) {
						if(data){
							var html = '';
							for(var i=0;i<data.length;i++){
								if(data[i].type==1){
									html+= "<li class='lis_zg'><div class='tit'><i>"+data[i].work_name+"</i><span class='float_r'>"+data[i].show_date+"</span></div><p>"+data[i].work_content+"</p><input type='hidden' gw='"+data[i].fill_post_name+"' xm='"+data[i].project_num+"' sx='"+data[i].matter_id+"' mid='"+data[i].id+"' noedit='"+data[i].noedit+"'></li>";
								}
								if(data[i].type==2){
									html+= "<li class='lis_cc'><div class='tit'><i>"+data[i].work_name+"</i><span class='float_r'>"+data[i].show_date+"</span></div><p>"+data[i].work_content+"</p><input type='hidden' gw='"+data[i].fill_post_name+"' xm='"+data[i].project_num+"' sx='"+data[i].matter_id+"' mid='"+data[i].id+"' noedit='"+data[i].noedit+"'></li>";
								}
								if(data[i].type==3){
									html+= "<li class='lis_xx'><div class='tit'>"+data[i].type_name+"<span class='float_r'>"+data[i].show_date+"</span></div><p>代理人:"
									if(data[i].agent_post){
										html+= ""+data[i].agent+"-"+data[i].agent_post+"";
									}else{
										html+= ""+data[i].agent_name+"-"+data[i].position+"";
									}
									html+= "</p><input type='hidden' gw='"+data[i].fill_post_name+"' xm='"+data[i].project_num+"'";
										if(data[i].agent_post){
											html+= "name='"+data[i].agent+"' zw='"+data[i].agent_post+"' sj='"+data[i].agent_tel+"'";
										}else{
											html+= "name='"+data[i].agent_name+"' zw='"+data[i].position+"' sj='"+data[i].mobilephone+"'";
										}
									html+= " mid='"+data[i].id+"' noedit='"+data[i].noedit+"' cur='"+data[i].status+"'></li>";
								}
								if(data[i].type==4){
									html+= "<li class='lis_qj'><div class='tit'>"+data[i].type_name+"<span class='float_r'>"+data[i].show_date+"</span></div><p>EKP单号:"+data[i].ekp+"</p><input type='hidden' gw='"+data[i].fill_post_name+"' xm='"+data[i].project_num+"' ekp='"+data[i].ekp+"' mid='"+data[i].id+"' noedit='"+data[i].noedit+"'></li>";
								}
							}
							$('.schedule_list ul').html(html)
						}else{
							$('.schedule_list ul').html('')
						}
					}
				})
        	}
		});
    })
</script>
</body>
</html>